
from flask import Flask
from flask_cors import *
import requests
app = Flask(__name__)
CORS(app, resources=r'/*',supports_credentials=True)  # 注册CORS, "/*" 允许访问所有api
# 获取热榜请求api
@app.route('/gethotrank',methods=["GET"])
def gethotdata():
    url="https://blog.csdn.net/phoenix/web/blog/hot-rank?page=0&pageSize=25&type="
    head={
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    }
    date=requests.get(url,headers=head)
    date=date.json()
    # print(date)
    return date
if __name__ == '__main__':
    app.run('127.0.0.1',debug=True,port=5000)

